<?php
    header('Content-type:text/json');
    require "../../connection.php";
    try{
            $selectId = $_POST['selectlist'];
            $sql = 'update banner set `ban_isshow` = 0 where id in ('.implode(",",$selectId).")";
//             $result = NULL;
//             foreach($selectId as $value){
//                 $option = array("id"=>$value);
            // 找到文件 先删除 文件 再清理数据库
             //   $res = $conn->where($option)->select("banner");
              //  $url = $res[0]['ban_url'];
             //   $dirpath ="../images/advertising";
              //  $filename = str_replace("/admin/images/advertising/","",$url);
              //  delFile($dirpath,$filename);
//                 $op = array("status"=>2);
            $result = $conn->doSql($sql);
            if($result){
                $msg = "删除成功";
                $status = "1";
            }else{
                $msg = "删除失败";
                $status = "0";
            }
           $data = array("status"=>$status,"msg"=>$msg);
            echo json_encode($data);
    }catch(Exception $e){
        print_r($e->getMessage());
    }
   function delFile($dir,$filename){
           $curfile = $dir."/".$filename;
           if(file_exists($curfile)){
                unlink($curfile);

           }else{
                echo "文件不存在";
           }
     }
?>